package com.svo.md.service.impl;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;

import com.b510.bean.Person;
import com.b510.service.impl.PersonRowMapper;
import com.svo.md.bean.SecretEntity;
import com.svo.md.bean.UserEntity;
import com.svo.md.service.SecretService;
import com.svo.md.service.UserService;

public class SecretServiceBean implements SecretService {
	/**
	 * 数据源
	 */
	private DataSource dataSource;
	/**
	 * spring提供的jdbc操作辅助类
	 */
	private JdbcTemplate jdbcTemplate;

	// 设置数据源
	public void setDataSource(DataSource dataSource) {
		this.jdbcTemplate = new JdbcTemplate(dataSource);
	}

	@Override
	public void save(SecretEntity entity) {
		jdbcTemplate.update("insert ignore into md_secret_key(secret,md5,devId,startTime,endTime,proxy_channel)values(?,?,?,?,?,?)",
                new Object[] { entity.getSecret(), entity.getMd5(),entity.getDevId(),entity.getStartTime(),entity.getEndTime(),entity.getProxy_channel()}, 
                new int[] { java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.TIMESTAMP , java.sql.Types.TIMESTAMP,java.sql.Types.VARCHAR});
	}

	@Override
	public void update(SecretEntity entity) {
		// TODO Auto-generated method stub

	}

	@Override
	public SecretEntity getSecret(String secret) {
		// TODO Auto-generated method stub
		return null;
	}

}
